package com.xuchang.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xuchang.domain.Notice;
import com.xuchang.service.NoticeService;
import com.xuchang.mapper.NoticeMapper;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

/**
* @author xuchang
* @description 针对表【notice(系统资讯公告信息)】的数据库操作Service实现
* @createDate 2025-06-29 22:19:07
*/
@Service
public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice>
    implements NoticeService{

    @Override
    public Page<Notice> findByPage(Page<Notice> page, String title, String startTime, String endTime, Integer status) {
        LambdaQueryWrapper<Notice> wrapper = new LambdaQueryWrapper<Notice>().like(!StringUtils.isEmpty(title), Notice::getTitle, title)
                .eq(status != null, Notice::getStatus, status)
                .between(!StringUtils.isEmpty(startTime) && !StringUtils.isEmpty(endTime), Notice::getCreated, startTime, endTime + " 23:59:59");
        return super.page(page,wrapper) ;
    }
}




